import 'package:dss_base/utils/navigator_util.dart';
import 'package:dss_base/widgets/basis/container_x.dart';
import 'package:dss_base/widgets/basis/image_x.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ImageBack extends StatelessWidget {
  const ImageBack({super.key, this.isBlack = true, this.onPressed});

  final bool isBlack;

  final GestureTapCallback? onPressed;

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(builder: (context, constraints){
      double size = constraints.maxHeight;
      return ContainerX(
        onPressed: onPressed ?? () {
          NavigatorUtil.back();
        },
        width: size,
        height: size,
        padding: EdgeInsetsGeometry.all(20),
        child: ImageX(
          urlOrPath: isBlack ? 'dss_base/ic_back_black.png' : 'dss_base/ic_back_white.png',
        ),
      );
    });
  }
}
